// 存储数据到 localStorage
localStorage.setItem("username", "John");

// 从 localStorage 获取数据
const username = localStorage.getItem("username");
console.log(username); // 输出 "John"

// 删除 localStorage 中的数据
localStorage.removeItem("username");